home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 May / CMCD0504.ISO / Software / Freeware / Programare / gdiplusdelphi / demos / Using Image Encoders and Decoders / Listing Installed Encoders / Unit1.pas < prev   
Encoding:
Pascal/Delphi Source File  |  2002-02-15  |  2.3 KB  |  71 lines

  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  7.   Dialogs, StdCtrls, ComObj;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Memo1: TMemo;
  12.     procedure FormCreate(Sender: TObject);
  13.   private
  14.     { Private declarations }
  15.   public
  16.     { Public declarations }
  17.   end;
  18.  
  19. var
  20.   Form1: TForm1;
  21.  
  22. implementation
  23. uses GDIPAPI, GDIPOBJ, GDIPUTIL;
  24.  
  25. {$R *.dfm}
  26.  
  27. procedure TForm1.FormCreate(Sender: TObject);
  28. var
  29.   num, size: UINT;
  30.   ImageCodecInfo: PImageCodecInfo;
  31.   j: Integer;
  32. type
  33.   ArrImgCodInfo = array of TImageCodecInfo;
  34. begin
  35.    memo1.Clear;
  36.    // How many encoders are there?
  37.    // How big (in bytes) is the array of all ImageCodecInfo objects?
  38.    GetImageEncodersSize(num, size);
  39.  
  40.    // Create a buffer large enough to hold the array of ImageCodecInfo
  41.    // objects that will be returned by GetImageEncoders.
  42.    getmem(ImageCodecInfo, size);
  43.  
  44.    // GetImageEncoders creates an array of ImageCodecInfo objects
  45.    // and copies that array into a previously allocated buffer.
  46.    // The third argument, imageCodecInfo, is a pointer to that buffer.
  47.    GetImageEncoders(num, size, ImageCodecInfo);
  48.  
  49.    // for each ImageCodecInfo object.
  50.    for j := 0 to num - 1 do
  51.    begin
  52.      memo1.Lines.Add(format('Clsid: %s',[GUIDToString(ArrImgCodInfo(ImageCodecInfo)[j].Clsid)]));
  53.      memo1.Lines.Add(format('FormatID: %s',[GUIDToString(ArrImgCodInfo(ImageCodecInfo)[j].FormatID)]));
  54.      memo1.Lines.Add(format('CodecName: %s',[ArrImgCodInfo(ImageCodecInfo)[j].CodecName]));
  55.      memo1.Lines.Add(format('DllName: %s',[ArrImgCodInfo(ImageCodecInfo)[j].DllName]));
  56.      memo1.Lines.Add(format('FormatDescription: %s',[ArrImgCodInfo(ImageCodecInfo)[j].FormatDescription]));
  57.      memo1.Lines.Add(format('FilenameExtension: %s',[ArrImgCodInfo(ImageCodecInfo)[j].FilenameExtension]));
  58.      memo1.Lines.Add(format('MimeType: %s',[ArrImgCodInfo(ImageCodecInfo)[j].MimeType]));
  59.      memo1.Lines.Add(format('Flags: $%x',[ArrImgCodInfo(ImageCodecInfo)[j].Flags]));
  60.      memo1.Lines.Add(format('Version: %d',[ArrImgCodInfo(ImageCodecInfo)[j].Version]));
  61.      memo1.Lines.Add(format('SigCount: %d',[ArrImgCodInfo(ImageCodecInfo)[j].SigCount]));
  62.      memo1.Lines.Add(format('SigSize: %d',[ArrImgCodInfo(ImageCodecInfo)[j].SigSize]));
  63.      memo1.Lines.Add('');
  64.    end;
  65.  
  66.    freemem(ImageCodecInfo);
  67.  
  68. end;
  69.  
  70. end.
  71.